#include "MapCatalog.h"

MapCatalog::MapCatalog()
{
}

MapCatalog::~MapCatalog()
{
}

void MapCatalog::AddMap(const Map& map)
{
	maps.push_back(map);

	//Is this the first map we added?
	if(maps.size() == 1)
		it = maps.begin();
}

const Map* MapCatalog::GetCurrentMap() const
{
	if(maps.empty())
		return NULL;
	else
		return (&(*it));
}

void MapCatalog::Next()
{
	//More then 1 map in the list? if not, don't bother trying to change it
	if(maps.size() > 1)
	{
		it++;
		if(it == maps.end())
			it = maps.begin();

	}

}

void MapCatalog::previous()
{
	//More then 1 map in the list? if not, don't bother trying to change it
	if(maps.size() > 1)
	{
		if(it == maps.begin())
			it = maps.end();
	
		it--;
	}
}